<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp"%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>OA</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
<script type="text/javascript" src="<c:url value='/ui/jquery.min.js'/>"></script>
<script type="text/javascript" src="<c:url value='/ui/cqoa.setting.js'/>"></script>
<script type="text/javascript">
var ctx = "${ctx}";
//修改标题
document.title = CQOA.title;
//样式输出
document.writeln('<link rel="stylesheet" href="'+ctx+'/css/'+CQOA.defaultStyle+'/'+CQOA.defaultCss+'" class="ui-style">');
</script>
<link rel="stylesheet" type="text/css" href="<c:url value='/css/style.css'/>" />
<!--[if lt IE 8.]>
<link rel="stylesheet" type="text/css" href="css/style-ie.css" />
<![endif]-->
<!--[if lt IE 7.]>
<link rel="stylesheet" type="text/css" href="css/style-ie6.css" />
<![endif]-->
<link rel="stylesheet" type="text/css" href="<c:url value='/ui/themes/default/easyui.css'/>">
<link rel="stylesheet" type="text/css" href="<c:url value='/ui/themes/icon.css'/>">
<script type="text/javascript" src="<c:url value='/ui/loader.js'/>"></script>
<script type="text/javascript">
function refresh(){
	document.getElementById("randCodeImg").src=ctx+"/check"; 
};


$(function(){
	$('#copyright').text(CQOA.copyright);
	$('#name').focus();
	var ieCount=0;
	var errorMsg = $("#error").val();
	if(errorMsg != "" && errorMsg != undefined){
		$.messager.show({
            msg: '<div style="color:black;">'+errorMsg+'</div>'
        });
		$("#error").val('');
	}
	
	$('#login').bind('click',function(){
		
		if(ieCount>0){
		    	return false;
		 }
		 ieCount ++;
		var tj_username = $("#name").val();
        var tj_password = $("#pwd").val();
		if ("" == tj_username || "" == tj_password) {
            //提示错误信息
			$.messager.show({
	        	showType:'show',
	        	middle:true,
	            msg: '<div style="color:black;">请输入用户名和密码</div>'
	        });
			ieCount = 0;
            return false;
        }
		 document.loginform.submit();
	});
	
	$('#clearText').bind('click',function(){
		$('#pwd').val('');
		$('#name').val('');
		ieCount = 0;
	});
	//绑定事件
	$("#name").bind("keydown",function(){
		if (document.addEventListener) {//如果是Firefox 
	        document.addEventListener("keypress", keyToPassword, true);
	    }
	    else {
	        document.attachEvent("onkeypress", keyToPassword);
	    }
	    function keyToPassword(evt){
	    	if (evt.keyCode == 13) {
		       $('#login_password').focus();
			   return false;
			}
	    };
	});
	$("#pwd").bind("keydown",function(){
		   if (document.addEventListener) {//如果是Firefox 
		        document.addEventListener("keypress", fireFoxHandler, true);
		    }
		    else {
		        document.attachEvent("onkeypress", ieHandler);
		    }
		    
		    function fireFoxHandler(evt){
		        if (evt.keyCode == 13) {
		        	$("#login").trigger("click");
		        	return false;
		        }
		    };
		    function ieHandler(evt){
		        if (evt.keyCode == 13) {
		        	$("#login").trigger("click");
		        	return false;
		        }
		    };
	});
	
	
});

</script>
</head>
<body>
	<!-- Main Body Starts Here -->
	<div id="main_body">

		<!-- Form Title Starts Here -->
		<div class="form_title">
			<strong style="color: white;">OA协同办公系统</strong>
		</div>
		<!-- Form Title Ends Here -->

		<!-- Form Starts Here -->
		<div class="form_box">
			<input id="error" type="hidden" value="${sessionScope.LOGIN_ERROR}"/>
			<form id="loginform" name="loginform" method="post" action="login.action">
				<!-- User Name -->
				<p class="form_text">*用户名</p>
				<p class="form_input_BG">
					<input type="text" name="username" id="name" value="" />
				</p>
				<!-- User Name -->
				<!-- Clear -->
				<p class="clear">&nbsp;</p>
				<!-- Clear -->
				<!-- Password -->
				<p class="form_text">*密&nbsp;&nbsp;&nbsp;&nbsp;码</p>
				<p class="form_input_BG">
					<input type="password" name="password" id="pwd" value="" />
				</p>
				<!-- -->
				<p class="clear">&nbsp;</p>
				
				<p class="form_text">*验证码</p>
				<p class="form_input_BG">
					<input type="text" name="randCode" id="randCode"/>
				</p>
				<p >
					<img id="randCodeImg" title="验证码" src="${ctx}/check"><a style="color: red;position: relative;top: -8px;" href="#" onclick="refresh();">换一张</a>
				</p>
				 
				<!-- Password -->
				<!-- Clear -->
				<p class="clear">&nbsp;</p>
				<!-- Clear -->
				<p class="form_login_signup_btn">
					<a id="login" style="margin-left: 90px;"><img src="<c:url value='/images/login_btn.png'/>"></img></a>
					<a id="clearText"><img src="<c:url value='/images/signup_btn.png'/>"></img></a>
				</p>
			</form>
		</div>
		<!-- Form Ends Here -->
	</div>
	<!-- Main Body Ends Here -->
	<!-- Copyright -->
	<div id="copyright" style="text-align: center; margin-top: 20px;">
		
	</div>
	<!-- Copyright -->
</body>
</html>
<%
 session.removeAttribute(oa.base.session.SessionManger.LOGIN_ERROR);
%>

